package org.nf.shopping.service.Impl;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.nf.shopping.entity.Commodity;
import org.nf.shopping.mapper.CommodityMapper;
import org.nf.shopping.service.CommodityService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author czl
 * @Date 2024-12-18
 */
@Service
@RequiredArgsConstructor
public class CommodityServiceImpl implements CommodityService {

    private final CommodityMapper commodityMapper;
    @Override
    public PageInfo<Commodity> listCommodity(Integer pageSize, Integer pageNum, String name) {
        List<Commodity> list = commodityMapper.listCommodity(pageSize,pageNum,name);
        PageInfo<Commodity> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public void updateCommodity(Commodity commodity) {
        commodityMapper.updateCommodity(commodity);
    }

    @Override
    public void deloneCommodity(Integer id) {
        commodityMapper.deloneCommodity(id);
    }

    @Override
    public void addCommodity(Commodity commodity) {
        commodityMapper.addCommodity(commodity);
    }

    @Override
    public List<Commodity> getCommodityList() {
        return commodityMapper.getCommodityList();
    }
}
